import service from './request'
import md5 from 'js-md5'
import { useFlockInfoStore } from '@/stores/flockInfo'
import { useBaseParamStore } from '@/stores/baseParams'

const cqBaseUrl = import.meta.env.VITE_CQ_SERVER_URL
const accountId = import.meta.env.VITE_CQ_ACCOUNT_ID
const salt = import.meta.env.VITE_CQ_LOGIN_SALT
const headers = { 'Content-Type': 'application/json' }

// 查询任务分析区指标接口
export const getTaskAnalysisMetrics = (params) => {
  return service.post(
    cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/setTaskAnalysisMetrics',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 查询任务分析区指标接口
export const getTaskTend = (params) => {
  return service.post(
    cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/taskTend',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 服务部精准巡查调度（服务员）-任务跟踪
export const getTaskTrace = (params) => {
  return service.post(
    cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/taskTrace',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 服务部精准巡查调度（服务员）- 超时任务
export const getOverTimeTask = (params) => {
  return service.post(
    cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/overTimeTask',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 服务部精准巡查调度（服务员）-每日任务耗时分析
export const getTodayTaskTime = (params) => {
  return service.post(
    cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/todayTaskTime',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 服务员巡查路线建议
export const getPatrolAlarmLocationByUserId = (params) => {
  return service.post(
    cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/getPatrolAlarmLocationByUserId',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

// 获取当前服务员巡查路径
export const getTrajectoryPath = (params) => {
  return service.post(
    cqBaseUrl + '/kapi/v2/wens/wens_area_digital_space/patrolWaiter/getTrajectoryPath',
    {
      ...params
    },
    {
      headers: headers
    }
  )
}

